package artid.com.arttogoa.parser;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * 
 *    
 * 项目名称：ArtworkArtA   
 * 类名称   ：MyArtPushParser   
 * 类描述   ：我的艺推实体类+解析   
 * 创建人   ：耿卫斌   
 * 创建时间：2016-11-7 上午10:47:33   
 *
 */
public class MyArtPushParser extends AppItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private List<MyArtPush_IbeaconListBean> ibeaconlist;
	@Override
	public void parse(JSONObject obj) {
		// TODO Auto-generated method stub
		if (null == obj) {
			return;
		}
		try {
			JSONArray jsonArray = obj.getJSONArray("ibeaconlist");
			ibeaconlist = new ArrayList<MyArtPush_IbeaconListBean>();
			for (int i = 0; i < jsonArray.length(); i++) {
				JSONObject jsonObject = jsonArray.getJSONObject(i);
				MyArtPush_IbeaconListBean ibeaconListBean = new MyArtPush_IbeaconListBean();
				ibeaconListBean.setIbeaconid(jsonObject.optString("ibeaconid"));
				ibeaconListBean.setIbeaconnumber(jsonObject.optString("ibeaconnumber"));
				JSONArray jsonArray2 = jsonObject.optJSONArray("ibactivitylist");
				List<MyArtPush_IbactivityListBean> ibactivitylist=new ArrayList<MyArtPush_IbactivityListBean>();
				if(jsonArray2!=null){
					for (int j = 0; j < jsonArray2.length(); j++) {
						JSONObject jsonObject2 = jsonArray2.getJSONObject(j);
						MyArtPush_IbactivityListBean ibactivityListBean=new MyArtPush_IbactivityListBean();
						ibactivityListBean.setIbactivityid(jsonObject2.optString("ibactivityid"));
						ibactivityListBean.setIbactivitytitle(jsonObject2.optString("ibactivitytitle"));
						ibactivityListBean.setIbactivityimage(jsonObject2.optString("ibactivityimage"));
						ibactivityListBean.setAddtime(jsonObject2.optString("addtime"));
						ibactivityListBean.setStatus(jsonObject2.optString("status"));
						ibactivitylist.add(ibactivityListBean);
					}
				}
				ibeaconListBean.setIbactivitylist(ibactivitylist);
				ibeaconlist.add(ibeaconListBean);
			}
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public List<MyArtPush_IbeaconListBean> getIbeaconlist() {
		return ibeaconlist;
	}
	public void setIbeaconlist(List<MyArtPush_IbeaconListBean> ibeaconlist) {
		this.ibeaconlist = ibeaconlist;
	}
	public MyArtPushParser() {
		super();
	}
	public MyArtPushParser(List<MyArtPush_IbeaconListBean> ibeaconlist) {
		super();
		this.ibeaconlist = ibeaconlist;
	}
	@Override
	public String toString() {
		return "MyArtPushParser [ibeaconlist=" + ibeaconlist + "]";
	}
}
